home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue45
/
Clinic
/
NoDUNBox.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2000-11-02
|
1KB
|
44 lines
unit NoDUNBox;
interface
implementation
uses
Registry, CorbaObj;
const
Path = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
EnableAutoDial = 'EnableAutoDial';
DisableIt: Longint = 0;
var
EnableIt: Longint;
ChangeIt: Boolean;
initialization
//We're gonna play with the registry
with TRegistry.Create() do
try
//Flag for later on
ChangeIt := False;
//Do we have these Internet settings?
if OpenKey(Path, False) then
begin
//Check the AutoConnect option
ReadBinaryData(EnableAutoDial, EnableIt, SizeOf(EnableIt));
//If it is on, we will turn it off
ChangeIt := EnableIt <> DisableIt;
if ChangeIt then
WriteBinaryData(EnableAutoDial, DisableIt, SizeOf(DisableIt));
end;
//We call this now to prevent a minor delay later on
//when CORBA stuff actually happens, but primarily so we
//can prevent the Dial-Up Networking box if necessary
CorbaInitialize;
//If we changed something, put it back to how it was
if ChangeIt then
WriteBinaryData(EnableAutoDial, EnableIt, SizeOf(EnableIt))
finally
Free
end
end.